package com.itheima.web.controller;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.itheima.domain.db.DataCount;

import com.itheima.vo.AnalysisSummaryVo;
import com.itheima.web.manager.AnalysisManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

@RestController
public class AnalysisController {

    @Autowired
    private AnalysisManager analysisManager;

    //查询首页概要统计信息
    @GetMapping("/dashboard/summary")
    public AnalysisSummaryVo analysisSummary(){
        return analysisManager.analysisSummary();
    }

    //todo 数据统计
    @GetMapping("/dashboard/users")
    public DataCount DateGather(Integer type,
                                @RequestParam("sd")Long startDate,
                                @RequestParam("ed")Long endDate){
        return analysisManager.DateGather(startDate,endDate,type);
    }



}
